﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<script type="text/javascript" src="<%=basePath %>/bootstrap/js/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>/bootstrap/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="<%=basePath %>/bootstrap/css/bootstrap.min.css" />
	<style type="text/css">
		body{
			background-image:url("<%=basePath%>/bootstrap/img/5.jpg");
			 background-attachment :local; 
			 background-size: cover;
		}
		.container{
			margin-left:50px;
		}
		.container .nav{
			margin-left:120px;
		}
		.span3{
			background-image:url("<%=basePath%>/bootstrap/img/5.jpg");
		}
		.container-fluid{
			margin-top:70px;
			margin-left:-20px;
		}
		#navleft{
			font-size:18px;
		}
		#aleft{
			color:black;
		}
		#aleft:hover{
			color:blue;
		}
		.pagerhader,.reqiredtable {
			background-image:url("<%=basePath%>/bootstrap/img/5.jpg");
			border-bottom: 1px solid #DADEE5;
			font-size: 18px;
			padding: 15px 30px;
			position: relative;
		}
		.othertable{
			border-bottom: 1px solid #DADEE5;
			font-size: 18px;
			padding: 15px 30px;
			position: relative;
		}
		.pagecontent .time {
			width: 50px;
		}
		td {
			padding: 0.8em;
		}
	</style>
</head>
<body>
	<!--导航-->
	   <	   <div id="navbar-example" class="navbar navbar-fixed-top">
            <div class="navbar-inner">
              <div class="container" style="width: auto; height:10px">
                <a class="brand" href="#">CRM</a>
                <ul class="nav">
					<li class="">
						 <form id="searchForm" class="navbar-search pull-left" action="http://www.google.com.hk/search" method="get">
								<input type="text" id="search" class="search-query span5" name="q" autocomplete="off" placeholder="Google Search"/>
								<script>
									$(document).ready(function(){
										$("#search").keydown(function(){
											if(event.keyCode == 13) {
												$("searchForm").submit();
											}

										});

									});
								</script>
							</form>
					  </li>
					  <li class="">
						<a href="">用户名：${sessionScope.user.username }</a>
					  </li>
                  <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#menu1">
							账号&设置
							<b class="caret"></b>
						</a>
                    <ul class="dropdown-menu">
						  <li><a href="users.action">我的信息</a></li>
						  <li><a href="groups.action">小组成员</a></li>
						  <script type="text/javascript">
							$(document).ready(function(){
								$(".dropdown-toggle").dropdown();
							});
						 </script>
						</ul>
					</li>
					  <li class="">
						<a href="index.action">安全退出</a>
					  </li>
                </ul>
              </div>
            </div>
          </div>
		  <script type="text/javascript">
			$(document).ready(function(){
				$(".dropdown-toggle").dropdown();
			});
		  </script>

		  <!--左遍的内容-->
		<div class="container-fluid">
		  <div class="row-fluid">
			<div class="span3" style="background-color: #F0F5F8;border: 1px solid #DADEE5;width:170px;height:240px;padding-top:20px;margin-left:40px;">
				<div id="left">
					<ul class="nav nav-list" id="navleft">
					  <li>
						<a href="findAllMessage.action" id="aleft">
						   <img src="<%=basePath%>/bootstrap/img/22.png"/>
							最新动态
						</a>
					  </li>
					  <li>
						<a href="contacts.action" id="aleft">
						 <img src="<%=basePath%>/bootstrap/img/18.png"/>
							联系人
						</a>
					  </li>
					  <li>
						<a href="task.action" id="aleft">
						  <img src="<%=basePath%>/bootstrap/img/20.png"/>
							日程安排
						</a>
					  </li>
					  <li>
						<a href="deal.action" id="aleft">
						 <img src="<%=basePath%>/bootstrap/img/19.png"/>
							业务机会
						</a>
					  </li>
					  <li class="search">
						<a href="search.action" id="aleft">
							<img src="<%=basePath%>/bootstrap/img/21.png"/>
							搜索
						</a>
						</li>
					</ul>
				</div>
			</div>
			<!--中心的内容-->
			<div class="span6" style="border:1px solid #D7D7D7;background-color:white;width:550px">
				<div class="pagebody">

					<div class="pagerhader">
					修改交易：${deal.title }
					</div>
					<div class="pagecontent">
						<form action="dealupdate" method="post">
						<input type="hidden" name="deal.id" value="${deal.id }"/>
						<input type="hidden" name="uid" value="${sessionScope.user.id }"/>
							<div class="othertable">
								<div class="control-group">
						   			<label class="control-label" for="input01">合伙人</label>
						
						   				
								 		<select name="cid" id="select1">
                    						<c:forEach items="${contactsList }" var="c">
											<c:choose>
											<c:when test="${c.id==cid }">
												<c:if test="${c.name!=null}">
													<option value="${c.id }" selected="selected">${c.name}</option>
												</c:if>
												<c:if test="${c.name==null&&c.companyname!=null}">
													<option value="${c.id }" selected="selected">${c.companyname}</option>
												</c:if>
											</c:when>
										<c:otherwise>
											<c:if test="${c.name!=null}">
												<option value="${c.id }">${c.name }</option>
											</c:if>
											<c:if test="${c.name==null&&c.companyname!=null}">
												<option value="${c.id }">${c.companyname}</option>
											</c:if>
										</c:otherwise>
									</c:choose>
									</c:forEach>
                	 					 </select>
                	 				 <!-- 选择联系人中的公司 -->
                	  					
									</div>
						 	 
						  		 	<label class="control-label" for="input01">交易名称</label>
						  			 <div class="controls">
										<input type="text" name="deal.title" value="${deal.title }"/>
						 			 </div>
						   			<label class="control-label" for="input01"><strong>交易描述或背景</strong></label>
						   			<div class="controls">
									<textarea name="deal.content">${deal.content }</textarea>
						  			</div>
						   		 <!-- 这个忘了怎样设置 -->
						  			<label class="control-label" for="input01">交易金额</label>
						   			
						  		 <div class="controls">
							
									￥<input type="text" name="deal.money" value="${deal.money }"/>
									<label class="control-label" for="input01">修改交易的状态</label>
									
									<select name="deal.state" id="select1"><!--提交值得名称-->
										<option value="未知" 
											<c:if test="${deal.state== '未知'}">selected</c:if>
										></option>
										<option value="成功" 
										<c:if test="${deal.state== '成功'}">selected</c:if>
										>成功</option>
										<!--循环输出联系人-->
										<option value="跟踪"
										<c:if test="${deal.state== '跟踪'}">selected</c:if>
										>跟踪</option>
										<option value="失败"
										<c:if test="${deal.state== '失败'}">selected</c:if>
										>失败</option>
									</select>

									
									 <label class="control-label" for="input01">类型</label>
						  					 <div class="controls">
										<select name="typeid" id="select2">
							
										<c:forEach items="${dealtypeList}" var="dealtype">
									<c:choose>
									<c:when test="${deal.dealtype.id==typeid }">
										<option value="${dealtype.id }" selected="selected">${dealtype.type }</option>
									</c:when>
									<c:otherwise>
										<option value="${dealtype.id }">${dealtype.type }</option>
									</c:otherwise>
									</c:choose>
								</c:forEach>
							</select>
							
							  </div>

							<div class="controls">
							<c:choose>
								<c:when test="${deal.view.split(',')[0]=='all' }">
									<input type="radio" name="deal.view" value="all" checked="checked"/>所有人<br/>
									<input type="radio" name="deal.view" value="me"/>只有我能看见<br/>
									<input type="radio" name="deal.view" id="radio1" value="group"/>
									选择一个组<!--需要写个下拉框-->
									<select name="g" id="select1"><!--提交值得名称-->
									<!--循环-->
										<c:forEach items="${uglist }" var="ug">
											<option value="${ug.id }">${ug.groupname }</option>
										</c:forEach>
									</select>
									<br/>
									<input type="radio" name="deal.view" value="use" id="radio2"/>
									选择用户<!--需要写个下拉框-->
									<select name="u" id="select2">
									<!--循环-->
										<c:forEach items="${ulist }" var="u">
											<option value="${u.id }">${u.username }</option>
										</c:forEach>
									</select>
								</c:when>
							
							</c:choose>
							<c:choose>
								<c:when test="${deal.view.split(',')[0]=='me' }">
									<input type="radio" name="deal.view" value="all"/>所有人<br/>
									<input type="radio" name="deal.view" value="me" checked="checked"/>只有我能看见<br/>
									<input type="radio" name="deal.view" id="radio1" value="group"/>
									选择一个组<!--需要写个下拉框-->
									<select name="g" id="select1"><!--提交值得名称-->
									<!--循环-->
										<c:forEach items="${uglist }" var="ug">
											<option value="${ug.id }">${ug.groupname }</option>
										</c:forEach>
									</select>
									<br/>
									<input type="radio" name="contacts.view" value="use" id="radio2"/>
									选择用户<!--需要写个下拉框-->
									<select name="u" id="select2">
									<!--循环-->
										<c:forEach items="${ulist }" var="u">
											<option value="${u.id }">${u.username }</option>
										</c:forEach>
									</select>
								</c:when>
							</c:choose>
							<c:choose>
								<c:when test="${deal.view.split(',')[0]=='group' }">
									<input type="radio" name="deal.view" value="all"/>所有人<br/>
									<input type="radio" name="deal.view" value="me"/>只有我能看见<br/>
									<input type="radio" name="cdeal.view" id="radio1" value="group" checked="checked"/>
									选择一个组<!--需要写个下拉框-->
									<select name="g" id="select1"><!--提交值得名称-->
									<!--循环-->
										<option value="${deal.view.split(',')[1] }">${group.groupname }</option>
										<c:forEach items="${uglist }" var="ug">
										<c:if test="${deal.view.split(',')[1] != ug.id }">
											<option value="${ug.id }">${ug.groupname }</option>
											</c:if>
										</c:forEach>
									</select>
									<br/>
									<input type="radio" name="deal.view" value="use" id="radio2"/>
									选择用户<!--需要写个下拉框-->
									<select name="u" id="select2">
									<!--循环-->
										<c:forEach items="${ulist }" var="u">
											
											<option value="${u.id }">${u.username }</option>
											
										</c:forEach>
									</select>
								</c:when>
							</c:choose>
							<c:choose>
								<c:when test="${deal.view.split(',')[0]=='use' }">
									<input type="radio" name="deal.view" value="all"/>所有人<br/>
									<input type="radio" name="dealview" value="me"/>只有我能看见<br/>
									<input type="radio" name="deal.view" id="radio1" value="group"/>
									选择一个组<!--需要写个下拉框-->
									<select name="g" id="select1"><!--提交值得名称-->
									<!--循环-->
										
										<c:forEach items="${uglist }" var="ug">
											<option value="${ug.id }">${ug.groupname }</option>
										</c:forEach>
									</select>
									<br/>
									<input type="radio" name="deal.view" value="use" id="radio2"  checked="checked"/>
									选择用户<!--需要写个下拉框-->
									<select name="u" id="select2">
									<!--循环-->
										<option value="${deal.view.split(',')[1] }">${user.username }</option>
										<c:forEach items="${ulist }" var="u">
											<c:if test="${deal.view.split(',')[1] != u.id }">
												<option value="${u.id }">${u.username }</option>
											</c:if>
										</c:forEach>
									</select>
								</c:when>
							</c:choose>
						  </div>
						  

						 		 </div>
						  	<input type="submit" class="btn btn-primary" value="修改这个交易" id="btn"/> 
							</div>
					
						
				</form>
					</div>
				</div>
			</div>
			<div class="span3" style="background-color: #F0F5F8;border: 1px solid #DADEE5;width:170px;height:240px;padding-top:20px;margin-left:25px;">
				<div class="box">
					<h3 id="anpai">Did you know…</h3>
					<p>
						
You can create tasks via email by using your create-a-task-by-email dropbox addresses.
Subscribe to your iCalendar task feed to see Highrise tasks on your Backpack Calendar, Apple iCal, Mozilla Calendar or other program that supports the iCalendar format.
					</p>
				</div>
				</div>
				
				
</body>
</html>